<?php

if(isset($_POST))
{



try{  

	 $connect = new PDO('mysql:host=localhost;dbname=basketbal','cas','cas');
	 $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	 $query = "INSERT INTO articles_visibility (season, user_key, articleID) VALUES (:season, :user_key, :articleID)";
	 $statement = $connect->prepare($query);
	 $sql_status = $statement->execute(
	  array(
	   ':season'  => $_POST["season"],
	   ':articleID'  => $_POST["articleID"],
	   ':user_key'  => $_POST['user_key']
	  )
	 );

	 $title = $_POST["title"];

	 $output = '';
	 if ($sql_status) {
	 	  $output = ' <br><br>
	  <div class="alert alert-success">	  
	   Visibility has been successfully added
	  </div>
	  ';
	 } else {
	 	$output = "Something Wrong";
	 }

} catch (PDOException $e) {
    
    $output = $e->getMessage();
}

 echo $output;

}

?>

